<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <title>layuiAdmin 网站用户 iframe 框</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

  <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    <div class="layui-form-item">
      <label class="layui-form-label">姓名</label>
      <div class="layui-input-inline">
        <input type="hidden" name="id" th:value="${user?.id}"/>
        <input type="text" name="name" th:value="${ user?.name}" lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">邮箱</label>
      <div class="layui-input-inline">
        <input type="text" name="email" th:value="${ user?.email}" lay-verify="required|email" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">头像</label>
      <div class="layui-input-inline">
        <input type="text" name="headImg" th:value="${ user?.headImg}" readonly placeholder="请上传头像" autocomplete="off" class="layui-input" >
      </div>
      <button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-useradmin">上传头像</button>
    </div>


    <div class="layui-form-item" lay-filter="sex">
      <label class="layui-form-label">选择性别</label>
      <div class="layui-input-block">
        <input type="radio" name="sex" value="1" title="男" th:checked="${user?.sex == 1}">
        <input type="radio" name="sex" value="2" title="女" th:checked="${user?.sex == 2}">
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">班级</label>
      <div class="layui-input-inline">
        <select name="classId" lay-verify="required" lay-search="" >
          <option value="">搜索/选择班级</option>
          <option  th:each="c : ${classList}" th:selected="${user?.classId == c.classId}" th:value="${c.classId}"  th:text="${c.className}" >J1701</option>
        </select>
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">角色</label>
      <div class="layui-input-inline">
        <select name="roleId" lay-verify="required" >
          <option value="">选择角色</option>
          <option  th:each="role : ${roleList}" th:selected="${user?.roleId == role.roleId}" th:value="${role.roleId}"  th:text="${role.roleTitle}" >J1701</option>
        </select>
      </div>
    </div>


    <div class="layui-form-item layui-hide">
      <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
  </div>

  <script src="/layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'upload'], function(){
    var $ = layui.$
    ,form = layui.form
    ,upload = layui.upload;
    
    upload.render({
      elem: '#layuiadmin-upload-useradmin'
      ,url: layui.setter.base + 'json/upload/demo.js'
      ,accept: 'images'
      ,method: 'get'
      ,acceptMime: 'image/*'
      ,done: function(res){
        $(this.item).prev("div").children("input").val(res.data.src)
      }
    });
  })
  </script>
</body>
</html>